/*
* Author:  Greg Nowak and Vaibhav Sharma
* Michigan State University
* 
* This is the implementation of the NFC Wireless Sensor Network Application
*/
#include "StorageVolumes.h"
#include "Timer.h"
#include "NFCWireless.h"
// Configuration Information
configuration NFCWirelessAppC
{

}

// Implementation
implementation
{
  	components MainC, NFCWirelessC, LedsC;
  	components new LogStorageC(VOLUME_LOG, TRUE);
  	components new TimerMilliC() as Timer0;
  	components new TimerMilliC() as Timer1;
  	components new TimerMilliC() as TimerDiss;
  	components new TimerMilliC() as TimerToSleep;
  	components new TempSensorC() as Sensor;
  	components new AdcReadClientC();
  	components HilTimerMilliC;
    components HplMsp430GeneralIOC as GPIO;
	//NFCWirelessC.EnergyHarvesterDiscrete -> GPIO.ADC0;
    
  	NFCWirelessC -> MainC.Boot;
  	NFCWirelessC.LocalTime -> HilTimerMilliC;
  	NFCWirelessC.BatteryVoltage -> AdcReadClientC.Read;
  	AdcReadClientC.AdcConfigure -> NFCWirelessC.ACD_A4_Configure;
  	NFCWirelessC.Timer0 -> Timer0;
  	NFCWirelessC.Timer1 -> Timer1;
  	NFCWirelessC.TimerDiss-> TimerDiss;
  	NFCWirelessC.TimerToSleep -> TimerToSleep;
  	NFCWirelessC.Leds -> LedsC; 
	NFCWirelessC.LogRead -> LogStorageC;
	NFCWirelessC.LogWrite -> LogStorageC;
	
	NFCWirelessC.TemperatureReading -> Sensor;

    components ActiveMessageC;
    //components new AMSenderC(AM_NFCWIRELESS);

    //NFCWirelessC.Packet -> AMSenderC;
    //NFCWirelessC.AMPacket -> AMSenderC;
    //NFCWirelessC.AMSend -> AMSenderC;
    NFCWirelessC.RadioControl -> ActiveMessageC;
    
    components DisseminationC;
	NFCWirelessC.DisseminationControl -> DisseminationC;

    /*components new AMReceiverC(AM_NFCWIRELESS);
    NFCWirelessC.Receive -> AMReceiverC; */

    components new DisseminatorC(flashLogEntry_t, 0x1234) as Diss16C;
	NFCWirelessC.Value -> Diss16C;
	NFCWirelessC.Update -> Diss16C;
}
